<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/common/taglibs.jsp" %>
<%@ taglib prefix ="s" uri="/struts-tags"%>
<!DOCTYPE html>
<html lang="en">
	<head>
		<%@ include file="/common/common-css.jsp"%>
		
		<link rel="stylesheet" href="/loan_manager/css/common-loading.css">
		
		<style>
			#jquery-table td {
				cursor: pointer !important
			}
			
			.productthumbnail {
				width: 100px;
				height: 100px;
			}
			
			@media (min-width: 768px) and (max-width: 1200px) {
				.backup-text {
					width: 100px !important;
				}
			}
		</style>
	</head>
	<body  class="no-skin">
		<%@ include file="/common/common-loading.jsp"%>
		<div class="page-content">
			<div class="page-header" style="margin-bottom:0px;padding-bottom:10px;">
				<h1 id="fu_name">
				</h1>
			</div>
			<form id="queryForm" method="post">
			<div class="page-content-area">
				<div class="row">
					<div class="col-sm-12">
						<div class="widget-box" style="border:0px solid #ccc; border-top:none;border-bottom:none;">
							<div class="widget-header widget-header-blue widget-header-flat">
								<h4 class="widget-title">还款提醒用户信息</h4>
		
								<div class="widget-toolbar">
									<a href="#" data-action="collapse">
										<i class="ace-icon fa fa-chevron-up"></i>
									</a>
								</div>
							</div>
		
							<div class=" widget-body">
									<div class="widget-main" >
									
										<div class="form-group col-xs-12 col-sm-4 "> 
											<label class="col-sm-4 control-label" style="text-align: right" for="account">手机号:</label>
											<div class="col-sm-8" style="padding-left: 0;">
												<input type="text" style="padding-left: 0px" name="account"
													id="account">
											</div>
										</div>
										
										<div class="form-group col-xs-12 col-sm-4 "> 
											<label class="col-sm-4 control-label" style="text-align: right" for=""loanName"">贷款名称:</label>
											<div class="col-sm-8" style="padding-left: 0;">  
												<input type="text" style="padding-left: 0px" name="loanName"
													id=""loanName"">
											</div>
										</div>
										
										
										<div class="form-group col-xs-12 col-sm-4 "> 
											<label class="col-sm-4 control-label" style="text-align: right" for="periods">期数:</label>
											<div class="col-sm-8" style="padding-left: 0;">  
												<input type="text" style="padding-left: 0px" name="periods"
													id="periods">
											</div>
										</div>
										
										 <div class="form-group col-xs-12 col-sm-4 "> 
												<label class="col-sm-2 control-label"  style="text-align:right">贷款金额:</label>
												<div class="col-sm-6">
													<div class="input-daterange input-group col-sm-12">
														<input type="text" style="padding-left: 0px" name="startAmount" id="startAmount">
														<span class="input-group-addon" style="width:6px">
															<i class="fa fa-exchange"></i>
														</span>
														<input type="text" style="padding-left: 0px" name="endAmount" id="endAmount">
													</div>
												</div>
										</div>
										
										<div class="form-group col-xs-12 col-sm-4 "> 
												<label class="col-sm-2 control-label"  style="text-align:right">添加时间:</label>
												<div class="col-sm-6">
													<div class="input-daterange input-group col-sm-12">
														<input type="text" class="date-picker form-control" data-date-format="yyyy-mm-dd" style="padding-left:0px" name="startDate">
														<span class="input-group-addon" style="width:6px">
															<i class="fa fa-exchange"></i>
														</span>
														<input type="text" class="date-picker form-control" data-date-format="yyyy-mm-dd" style="padding-left:0px" name="endDate">
													</div>
												</div>
										</div>
										
										
									</div>
							</div>
						</div>
					</div>
						<div class="col-md-12 center">
						<div class="clearfix form-actions">
						
							<button class="btn btn-purple  no-border" type="button" name="btn-query" onclick="query_any()" id="btn-query">
								<i class="ace-icon fa fa-search icon-on-right bigger-110"></i>
								查询
							</button>
							&nbsp;&nbsp;&nbsp;
							<button class="btn btn-grey btn-lg no-border" type="reset">
								<i class="ace-icon fa fa-undo icon-on-right bigger-110"></i>
								重置
							</button>
							
						  </div>
				   </div>
				</div>
		 		<div class="row">
					<div class="col-xs-12">
						<table id="jquery-table" class="table table-striped table-bordered table-hover">
						</table>
					</div>
				</div>
			</div>
			</form>
		</div>
	</body>
</html>

<%@ include file="/common/common-js.jsp" %>
<!-- loading js -->
<script type="text/javascript" src="${ctx}/js/common-loading.js"></script>
<script type="text/javascript" src="${ctx}/js/call_func.js"></script>
<link rel="stylesheet" href="${ctx}/ace/css/just-tip.css"/>
<script src="${ctx}/ace/js/justTools.js"></script>

<!-- inline scripts related to this page -->
<script type="text/javascript">
		
    //【查询】按钮Click事件
	function query_any(){
	 	$("#output").removeAttr("style");
		if(jqTable != null){
			jqTable.fnDraw();
		} else {
			loaddata();
		}
		
	 };
	
	 var jqTable = null;
	 var loaddata = function(){
		jQuery(function($) {
			jqTable = $('#jquery-table').dataTable( {
			    //数据列控制（包括对应返回JSON属性名称，对应表头列索引位置、数据转换封装等）
			    "columnDefs": [
					{	  
						  "title":'手机号',
						  "name":"account",
						  "data": "account",
						  "targets": [0],
						  "class": "center",
						  "bSortable": false,
						  "width": "1%"
					},
					{	  
						  "title":'添加时间',
						  "name":"ctime",
						  "data": "ctime",
						  "targets": [1],
						  "class": "center",
						  "bSortable": false,
						  "width": "1%"
					},
					{	  
						  "title":'贷款名称',
						  "name":"party_a_name",
						  "data": "party_a_name",
						  "targets": [2],
						  "class": "center",
						  "bSortable": false,
						  "width": "1%"
					},
					{	  
						  "title":'贷款金额',
						  "name":"amount",
						  "data": "amount",
						  "targets": [3],
						  "class": "center",
						  "bSortable": false,
						  "width": "1%"
					},
			    	{	  
						  "title":'利率',
						  "name":"interest_rate",
						  "data": "interest_rate",
						  "targets": [4],
						  "class": "center",
						  "bSortable": false,
						  "width": "1%"
					},
					{	  
						  "title":'手续费',
						  "name":"fee",
						  "data": "fee",
						  "targets": [5],
						  "class": "center",
						  "bSortable": false,
						  "width": "1%"
					},
					{	  
						  "title":'期数',
						  "name":"periods",
						  "data": "periods",
						  "targets": [6],
						  "class": "center",
						  "bSortable": false,
						  "width": "1%"
					},
					{	  
						  "title":'还款周期',
						  "name":"repayment_cycle",
						  "data": "repayment_cycle",
						  "targets": [7],
						  "class": "center",
						  "bSortable": false,
						  "width": "1%",
						  "render":function(value, type, row){
						  	  if(value == "1w"){
						  	  	 return "每周";
						  	  }else if(value == "2w"){
						  	  	 return "每周";
						  	  }else if(value == "1m"){
						  	  	return "每月";
						  	  }
						  }
					},
					{	  
						  "title":'首次还款日',
						  "name":"repayment_date",
						  "data": "repayment_date",
						  "targets": [8],
						  "class": "center",
						  "bSortable": false,
						  "width": "1%"
					}
			  	],
				"sAjaxSource": ctx+"/accountBill/getList.action?rand=" + Math.random(),
				"fnServerData": function ( sSource, aoData, fnCallback ) {//从服务器请求数据
			   			var data = $('#queryForm').serializeObject();
						
						data.aoData = JSON.stringify(aoData);
						$.ajax({
							"type": "POST",
							"dataType": 'json',
							"url": sSource,
							"data":data,
							"timeout":300000,
							"beforeSend": function() {
								// 显示loading
								showLoading();
							},
							"success": function(resp){
								console.info(resp);
								hideLoading();
								fnCallback(resp);
								initListPage();
								
							},		
							"error": function(XMLHttpRequest, textStatus, errorThrown) {
								alert('请求服务器错误,请刷新重试！！');//错误提示，包括服务器重启导致的session失效
							},			
							"complete": function () {
								hideLoading();
							}
					});
				},
				"sScrollXInner": "100%",
				"sScrollY": "100%",//如果不设置，IE会有问题
			    "aaSorting": [[2,"desc"]] //初始化加载，默认按第几列排序、排序方式（列从0开始计算）
			});
			
			
		});
	}
	
	$(document).ready(function() {
		//时间范围插件初始化
			$('.date-picker').datepicker({
				autoclose : true,
				format : 'yyyy-mm-dd'
			});
			
		$("#output").hide();
	});
	

</script>